package group.sicher.core.exception.base;

/**
 * 常见错误代码
 */
public enum SicherErrorCode implements ErrorCode {

    DEFAULT_ERROR(600, "系统异常"),
    TOKEN_ERROR(601, "凭证无效"),
    PARAM_ERROR(602, "参数错误"),
    FORMAT_ERROR(603, "图片不符合要求"),
    LOGIN_ERROR(604, "用户名或密码错误"),
    PAYCHANS_EXIST(605, "通道已存在"),
    PAYMENT_EXIST(606, "支付方式已存在"),
    PAYCHANS_STATUS_ERROR(607, "通道状态错误"),
    RATE_ERROR(608, "费率不正确"),
    PAYMENT_STATUS_ERROR(609, "支付方式状态错误"),
    CAP_ERROR(610, "超出上限"),
    LIMIT_UPDATE_ERROR(611, "不可更新"),
    UP_ACCOUNT_ERROR(612, "上级帐号不可用"),
    PAYCHAN_NOT_ASIGN(613, "通道未分配"),
    IMAGE_INTO_ERROR(614, "图片进件提交失败"),
    MERCHANT_INTO_ERROR(615, "商户资料进件失败"),
    NODATA_ERROR(616, "没有数据"),
    EXPORT_ERROR(617, "导出数据失败"),
    SMS_ERROR(618, "短信发送失败"),
    USER_NOTEXIST_ERROR(619, "用户不存在"),
    SMS_CODE_ERROR(620, "短信验证码错误"),
    REFUND_NOSUPPORT_ERROR(621, "暂不支持退款"),
    RULE_EXIST_ERROR(622, "规则已存在"),
    CAPTCHA_TIMEOUT(623, "验证码失效"),
    CAPTCHA_ERROR(624, "验证码错误"),
    CODE_ERROR(625, "编号错误"),
    PHONE_ERROR(626, "手机号错误"),
    PASSWORD_ERROR(627, "密码错误"),
    REPEAT_RULE_ERROR(628, "已存在,不可重复添加"),
    AUTHORITY_ERROR(629, "权限不足"),
    ACCOUNT_LIMIT_LOGIN(630, "账号限制登录"),
    MASTER_NOT_EXIST(631, "店主账号错误"),
    SHOP_USER_NOT_EXIST(632, "店员编号错误"),
    COMPANY_NAME_ESIST(633, "名称已存在"),
    COMPANY_EXIST(634, "企业已存在"),
    LOGIN_LOCK(635, "该账号已被关闭"),
    PAYMENT_QRCODE_UNRECOGNIZED(636, "无法识别收款码"),
    PAYMENT_QRCODE_BOUND(637, "收款码已被绑定"),
    PAYMENT_QRCODE_NAME_EXIST(638, "收款码名称已存在"),
    PAYMENT_QRCODE_EXCEED_LIMIT(639, "收款码数量达到上限"),
    DEVICE_EXIST(640, "设备已被绑定"),
    UNRECOGNIZED_TWO_DIMENSIONAL(699, "未识别二维码或条码"),
    QRCODE_ERROR(700, "二维码生成失败"),
    USERNAME_EXIST(701, "用户已存在"),
    PHONE_EXIST(702, "手机号已存在"),
    NO_SELECT_CONDITION(703, "请选择需要导出交易记录条件"),
    DEFAULT_PASSWORD(800, "请重置密码"),
    SIGN_ERROR(650, "签名失败"),
    QRCODE_STATUS_ERROR(651, "此二维码已被删除禁用"),
    QRCODE_OWN_ERROR(652, "二维码主体错误");


    private Integer errCode;
    private String errMsg;

    SicherErrorCode(int code, String desc) {
        this.errCode = code;
        this.errMsg = desc;
    }

    @Override
    public Integer code() {
        return this.errCode;
    }

    @Override
    public String desc() {
        return this.errMsg;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("{CommonErrorCode:" + super.toString());
        sb.append(",         code:" + errCode);
        sb.append(",         desc:" + errMsg);
        sb.append("}");

        return sb.toString();
    }
}
